package com.dou.you.che.service.impl.sys;

import com.dou.you.che.service.sys.SysDomainServiceI;
import com.dou.you.che.comm.utils.IdUtil;
import com.dou.you.che.core.entity.sys.SysDomain;
import com.dou.you.che.core.mapper.sys.SysDomainDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * 域对象
 * @Author 黄国刚【1058118328@qq.com】
 */
@Service
@Transactional(readOnly = true)
public class SysDomainService implements SysDomainServiceI {

    @Autowired
    private SysDomainDao domainDao;

    @Override
    public SysDomain queryObject(String id) {
        return domainDao.queryObject(id);
    }

    @Override
    public List<SysDomain> queryList(Map<String, Object> map) {
        return domainDao.queryList(map);
    }

    @Override
    public int queryTotal(Map<String, Object> map) {
        return domainDao.queryTotal(map);
    }

    @Transactional(readOnly = false)
    @Override
    public int save(SysDomain domain) {
        domain.setId(IdUtil.createIdbyUUID());
        domain.setCreateTime(new Date());
        return domainDao.save(domain);
    }

    @Transactional(readOnly = false)
    @Override
    public int update(SysDomain domain) {
        domain.setUpdateTime(new Date());
        return domainDao.update(domain);
    }

    @Transactional(readOnly = false)
    @Override
    public int delete(String id) {
        return domainDao.delete(id);
    }

    @Transactional(readOnly = false)
    @Override
    public int deleteBatch(String[] ids) {
        return domainDao.deleteBatch(ids);
    }
}
